<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>html转text</title>
</head>
<script src="vue.js"></script>
<script src="https://cdn.staticfile.org/vue-resource/1.5.1/vue-resource.min.js"></script>
<body>
<div id="app">
    <button @click="get">html转text</button>
    <div>
        <textarea v-model="html" style="width: 500px;height: 800px"></textarea>
        <textarea v-model="text" style="width: 500px;height: 800px"></textarea>
    </div>

</div>
</body>
<script>
    var app = new Vue({
        el: '#app',
        data: {
            html:'',
            text: ''
        },
        methods:{
            get:function () {
                app.$http.post('/html/text',{text:app.html},{emulateJSON:true}).then(function(res){
                    app.text=res.bodyText;
                },function(){
                    app.text='请求失败处理';
                });
            }
        }

    })
</script>
</html>